format debug "--  Compiling NavButton Class . . .\n" undefined undefined

class NavButton(PushButton)
  Instance Variables
	destination
end --NavButton
method navigate self {class NavButton} bogus ->
(
	local myScene := self.presentedBy
	showScene myScene.myStage self.destination
)

Method init self {class NavButton}#rest args \
  					#key	castNum: \
  					lingo: 
  	->(
  		local releaseBitmap := castList[castNum].boundary
  		releaseBitmap.invisibleColor := whiteColor
  		local cName := findSXKey(lingo, "PressedPresenter")
  		local pressedCast
  		if cName = undefined then (
  			format debug "-- ERROR! PressedPresenter keyword missing" undefined @unadorned
  			pressedCast := castList[castNum]
  		) else (
			local cNum := getKeyOne castByName (cName as string)
  			pressedCast := castList[cNum]
  		)
  		local pressedBitmap := pressedCast.boundary
  		pressedBitmap.invisibleColor := whiteColor
  		local rp := new TwoDShape boundary:releaseBitmap
  		local pp := new TwoDShape boundary:pressedBitmap
  		apply nextMethod self	releasedPresenter:(rp) pressedPresenter:(pp) args
  		for tPres in #(rp, pp) do (
  			local tBox := tPres.bbox
			tPres.x := -(tBox.x1)
			tPres.y := -(tBox.y1)
		)
		self.destination := findSXKey(lingo,"toScene")
  		self.activateAction := navigate
  		self.authorData := self
  		return self
)

Method xSetter self {class NavButton} xVal ->
(
	nextMethod self (xVal + self.releasedPresenter.bbox.x1)
)

Method ySetter self {class NavButton} yVal ->
(
	nextMethod self (yVal + self.releasedPresenter.bbox.y1)
)

#(NavButton,#("destination"),#())
